package br.ufcg.edu.routers.config;

import java.io.IOException;

import junit.framework.TestCase;

public class LinksParserTest extends TestCase {
	
	public void test1() throws IOException {
		String configFile = "unitTests/files/enlaces1.config";
		LinksParser parser = new LinksParser(1, configFile);
		assertEquals("{2=10, 3=15}", parser.getCostsMap().toString());
		parser = new LinksParser(2, configFile);
		assertEquals("{1=10, 4=2, 5=5}", parser.getCostsMap().toString());
		parser = new LinksParser(3, configFile);
		assertEquals("{1=15, 4=2}", parser.getCostsMap().toString());
		parser = new LinksParser(4, configFile);
		assertEquals("{2=2, 3=2, 6=10}", parser.getCostsMap().toString());
		parser = new LinksParser(5, configFile);
		assertEquals("{2=5, 6=5}", parser.getCostsMap().toString());
		parser = new LinksParser(6, configFile);
		assertEquals("{4=10, 5=5}", parser.getCostsMap().toString());
	}
	
	public void test2() throws IOException {
		String configFile = "unitTests/files/enlaces2.config";
		LinksParser parser = new LinksParser(1, configFile);
		assertEquals("{2=3}", parser.getCostsMap().toString());
		parser = new LinksParser(2, configFile);
		assertEquals("{1=3, 3=3, 4=10}", parser.getCostsMap().toString());
		parser = new LinksParser(3, configFile);
		assertEquals("{2=3, 4=2}", parser.getCostsMap().toString());
		parser = new LinksParser(4, configFile);
		assertEquals("{2=10, 3=2}", parser.getCostsMap().toString());
	}

}
